import fs from "fs";
import archiver from "archiver";

const output = fs.createWriteStream('./admin.zip');

const archive = archiver('zip', {
  zlib: { level: 9 } // 设置压缩级别
});

output.on('close', function() {
  console.log(`压缩完毕生成文件大小${(archive.pointer() / 1024 / 1024).toFixed(1)}MB`)
});

archive.pipe(output);
archive.directory('./admin', './admin')
archive.finalize()
